package com.tzy.user.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
/**
 * web相关的配置类
 */
//@Configuration
public class WebConfig implements WebMvcConfigurer {

    private Logger log = LoggerFactory.getLogger("test");
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        log.info("添加拦截器 WebConfig => addInterceptors()");
        registry.addInterceptor(new AuthenticationInterceptor())
            .addPathPatterns("/api/**")//需要拦截的路径
                .excludePathPatterns("/api/user/login/**","/api/static/**/");//不需要拦截的路径
    }
}
